import axios from "@/utils/axios";

export function getUserList(params) {
    return axios({
        url: '/sys/user/list',
        method: 'GET',
        params: params
    })
}

export function save(data) {
    return axios({
        url: '/sys/user/save',
        method: 'POST',
        data: data
    })
}

export function getUserById(params) {
    return axios({
        url: '/sys/user/info/' + params,
        method: 'GET',
    })
}

export function delUserById(data) {
    return axios({
        url: '/sys/user/delete',
        method: "POST",
        data
    })
}

export function resetPasswd(data) {
    return axios({
        url: 'sys/user/resetPasswd',
        method: 'POST',
        data
    })
}

export function assignRole(data) {
    return axios({
        url: "/sys/user/role/" + data.userId,
        method: "POST",
        data: data.roleIds
    })
}

export function getUserRoleByUserId(params) {
    return axios({
        url: "/sys/user/role/" + params,
        method: "GET",
    })
}

export function updatePass(data) {
    return axios({
        url: 'sys/user/updatePass',
        method: 'POST',
        data
    })
}

export function updateUserinfo(data) {
    return axios({
        url: '/sys/user/updateUserInfo',
        method: 'POST',
        data
    })
}

export function uploadUserIcon(data) {
    return axios({
        url: '/sys/user/uploadIcon',
        method: 'POST',
        data
    })
}
